package com.dayu.metro.domain;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooJpaActiveRecord
public class Groups {

    @NotNull
    @Column(name = "group_name")
    @Size(max = 20)
    private String groupname;

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "groups")
    private Set<Users> members = new HashSet<Users>();

    @ManyToMany(cascade = CascadeType.ALL)
    private Set<Authorities> authorities = new HashSet<Authorities>();
}
